<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.7.14/dist/vue.js"></script>
</head>

<body>
    <div id="app">
        <ul>
            <li v-for="item in arr">
                <span>{{item}}</span>
                <button @click="del(item)">删除</button>
            </li>
        </ul>
        <button @click="create">生成</button>
    </div>
    <script>
        const app = new Vue({
            el: '#app',
            data: {
                arr: [1, 5, 3],

            },

            methods: {
                create() {
                    num = Math.floor(Math.random() * 10),
                        this.arr.push(num)
                },
                del(i) {
                    index = this.arr.findIndex(item => item === i)
                    this.arr.splice(index, 1)
                }
            },
        })
    </script>
</body>

</html>